import { credential } from '@/api/video'
import COS from 'cos-js-sdk-v5'
var Bucket = 'xszx-test-1251987637'
var Region = 'ap-beijing'
// 初始化实例
var cos = new COS({
  getAuthorization: function(options, callback) {
    // // 异步获取临时密钥
    credential().then(data => {
      var Info = data.data.data
      callback({
        TmpSecretId: Info.credentials.tmpSecretId,
        TmpSecretKey: Info.credentials.tmpSecretKey,
        XCosSecurityToken: Info.credentials.sessionToken,
        ExpiredTime: Info.expiredTime
      })
    })
  }
})

export {
  Bucket,
  Region,
  cos
}
